import http from './http';

const authApi = {

    /**
     * 登入
     */
    async post_login(params) {
        let formData = new URLSearchParams();
        formData.append('account', params.account);
        formData.append('password', params.password);
        return await http.post(`/user/auth/token`, formData);
    },


    /**
     * 注册账号
     * 注意：在APP注册的账号全部都是顾客 role: 'CUSTOMER',
     */
    async register(params) {
        return await http.post(`/users`, {
            ...params,
            role: 'CUSTOMER'
        });
    },

}

export default authApi;
